#include <stdio.h>

int a[3000] = {0};

int main()
{
	int n = 0;
	scanf("%d", &n);
	for ( int i = 0; i < n; i++ ) {
		scanf("%d", &a[i]);
	}
	
	int cnt = 0;
	for ( int i = 0; i < n-1; i++ ) {
		for ( int j = i + 1; j < n; j++ ) {
			if ( a[i] > a[j] ) {
				cnt ++;
			}
		}
	}
	printf("%d", cnt);
	return 0;
} 
